<template>
    <div>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td align="right">用户名</td>
                    <td><input type="text" v-model="queryInfo.name"></td>
                </tr>
                <tr>
                    <td align="right">密码</td>
                    <td><input type="password" v-model="queryInfo.pwd"></td>
                </tr>
                <tr>
                    <td align="right"></td>
                    <td><input type="button" value="登录" @click="Login" class="btn btn-primary"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref, reactive } from 'vue';


let queryInfo = reactive({
    name: '',
    pwd: '',
})

const Login = () => {

    axios({
        method: 'get',
        url: '/api/Admin/Login',
        params: queryInfo
    })
        .then(res => {
            if (res.data == -1) {
                alert("用户不存在");
            }
            else if (res.data == -2) {
                alert("密码错误");
            }
            else {
                alert("登录成功")
            }
        })
        .catch(err => {

        })

}

</script>

<style scoped></style>